package fun.pengzh.demo.kafka.sample4;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.kafka.core.KafkaTemplate;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author pengzh
 * @class Controller
 * @since 2021-09-14
 */
@RestController
public class Controller {

    @Autowired
    private KafkaTemplate<Object, Object> kafkaTemplate;

    @PostMapping("/send/{what}")
    public void sendtx(@PathVariable String what) {
        kafkaTemplate.send("topic4", what);
    }
}
